import request from './request'

export const createPost = async (postData) => {
  return request.post('/posts', postData)
}

export const fetchPosts = async (params = {}) => {
  return request.get('/posts', { params })
}

export const fetchPostById = async (postId) => {
  return request.get(`/posts/${postId}`)
}

export const likePost = async (postId) => {
  return request.post(`/posts/${postId}/like`)
}

export const unlikePost = async (postId) => {
  return request.delete(`/posts/${postId}/like`)
}